// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Data.SqlClient;
using KnessetCore.Dbl.KnessetTableAdapters;
using log4net;

namespace KnessetCore.Utils
{
	internal static class Constants
	{
		static Constants()
		{
			// Initialize connection string.
			Members = new ParliamentMembersTableAdapter();
			string conn = "Server=NONAME\\SQLEXPRESS;Database=KnessetDB;Trusted_Connection=True;";
			SqlConnection connection = new SqlConnection(conn);
			Members.Connection = connection;

			Hours = new HoursTableAdapter();
			Hours.Connection = connection;
		}
		/// <summary>
		/// Logs information regarding how information is written in the knesset site.
		/// Use this logger to indicate that the text structure in the knesset site has changed and
		/// therefore parsing it may cause invalid values.
		/// </summary>
		public static readonly ILog TextChangedLogger = LogManager.GetLogger("TextChanged");
		/// <summary>
		/// Log critical errors (unrecoverable errors).
		/// </summary>
		public static readonly ILog CriticalErrorLogger = LogManager.GetLogger("CriticalError");

		/// <summary>
		/// A table adapter for the ParliamentMembers table.
		/// </summary>
		public static readonly ParliamentMembersTableAdapter Members;
		/// <summary>
		/// A table adapter for the hours table.
		/// </summary>
		public static readonly HoursTableAdapter Hours;
		/// <summary>
		/// A X hours time span. Used to mark suspecious knesset members.
		/// </summary>
		public static TimeSpan SUSPECIOUS_OVER_TIME = new TimeSpan(12, 0, 0);
		/// <summary>
		/// The number of knesset members that we have.
		/// </summary>
		public static uint NUMBER_OF_KNESSET_MEMBERS = 120;
	}
}